var Otime="<?=$time?>";
var dyue = Otime.substring(0,2);

function Show_Time(){
	//var tid=$(".Tea_lock").html().substring(0,2);
	//var sis=$(".Tea_lock:contains('"+dyue+"')");
	//$("tr:lt(2)") 
	$('.Tea_lock').each(function(index,doxs){
		var xdf=$(doxs).html();
		var yud=xdf.substring(0,2);
		if(yud==dyue){
			var inxx=index-1;
			$(".Tea_lock:lt("+inxx+")").parent().attr("style","display:none;");
			return ;
			}
			//alert(yud);
		});}



function On_time(tq){
	var sut = $(tq).attr('id');
    $.ajax({
        type: "post",
        dataType: "json",
		data:'teacherId='+sut +'&date=<?=$date?>',
        url: "Teacher_getTeacherTime.html",
        success: function(data){
		$('.Tea_butt').empty();
		 $(data).each(function(i){
			$('.Tea_lock').each(function(index,doum){
				if(data[i].time==$(doum).html()){$(doum).after("<a class='Tea_butt' href='user_booking.html?id="+data[i].id+"'><img src='user/images/tach2.jpg' width='59' height='25' /></a>");}
});});}});}

function selTeac(yus){
	var sed = $(yus).attr('data');
  $('#Ttime option').each(function(index,doexs){ 
 			var yu = $(doexs).attr('value'); 
  	if(sed == yu){
		$('#Ttime option').eq(index).attr('selected','selected');
		$("form[name='Forsd']") .submit();
		}
 	});
	
}


$(document).ready(function(){
	$('.Teach_Ico li').attr('style','background:#fff;');
    var dx =  $('.Teach_Ico li').eq(0);
    var old_click=dx.attr("id");
    var new_click=dx.attr("id");
    dx.attr('style','');
    dx.attr('class','WteachBg');
    On_time(dx);
	Show_Time();
	var ysueWidth = $('.Teahjsie').height();
	var tyuseHise = ysueWidth-1;
	$('.Ser_tab2').height(tyuseHise);$('.Ser_tab2').attr('style','line-height:'+tyuseHise+'px;');
    $('.Teach_Ico li').click(
    function(){var new_click=$(this).attr("id");
    if(new_click!=old_click){
	    $("#"+old_click).attr('style','background:#fff;');
	    $("#"+old_click).attr('class','');
	    $('#'+new_click).attr('style','');$('#'+new_click).attr('class','WteachBg');
	    old_click=new_click;
    }
	On_time(this);
	});
	$('.Tea_lock').click(function(){$('.Tea_lock').attr('class','Tea_lock');$(this).attr('class','Tea_lock Tea_usy'); selTeac(this);});
    $('.DengJisccsex a').click(function(){$('.DengJisccsex a').attr('class','');$(this).attr('class','onSerchs'); var sy = $(this).attr('date');$('.DengJisccsex input').attr('value',sy);});
	$('.SexDengJixsd a').click(function(){$('.SexDengJixsd a').attr('class','');$(this).attr('class','onSerchs'); var sy = $(this).attr('date');$('.SexDengJixsd input').attr('value',sy);});
    $('.Teahjsie a').click(function(){$('.Teahjsie a').attr('class','');$(this).attr('class','onSerchs'); var sy = $(this).attr('date');$('.Teahjsie input').attr('value',sy);});
    
});
/*function On_teach(){	
	$.ajax({ 
		type: "post",
        dataType: "json",
        url: "forum.php",
        success: function(data){
  		$(data).each(
			function(i){
			var w=0, length=data.length;
			for(; w<length; w++){
		 var html = '';
         html += '<li id="'+data[i].id+'">';
		 html += '<p><a href="#"><img src="images/a3.jpg" width="80" height="80" /></a></p>';
		 html += '<p><a href="#">'+ data[i].name+'老师</a></p>';
		 html += '<p><img src="images/xingxing'+data[i].level+'.png"/></p>';
         html+='<p><object width="110" height="20" data="js/introplayer.swf" type="application/x-shockwave-flash"><param value="js/introplayer.swf" name="movie"><param value="file=audio/20130423155743.mp3" name="FlashVars"></object></p>';
         html += '</li>';
		}$('#Teach_Ico').append(html);});}});}*/

